<div>
  <form class="form-horizontal" role="form" name="tradeStatForm" novalidate>
    <div class="form-ctrl md-whiteframe-z1">
      <div class="form-search" style="height:260px;" ng-class="{true: 'shou'}[flag.formIsFold]" ng-switch="tradeStat.timeType.timeTypeCode">
      <div>
        <label style="">渠道</label>
        <md-select ng-model="tradeStat.businessLine">
          <md-select-label>{{tradeStat.businessLine ? _getNames(tradeStat.businessLine,'businessLineName',selector.businessLine) : "天猫"}}</md-select-label>
          <md-option ng-value="businessLine" ng-repeat="businessLine in selector.businessLine" >{{businessLine.businessLineName}}</md-option>
        </md-select>
      </div>
      <div ng-show="tradeStat.businessLine && tradeStat.businessLine.businessLineName === '银行总对总'">
        <label style="">机构</label>
        <md-select ng-model="tradeStat.agencyType">
          <md-select-label>{{tradeStat.agencyType ? _getNames(tradeStat.agencyType,'name',selector.agencyType) : "省公司"}}</md-select-label>
          <md-option ng-value="agencyType" ng-repeat="agencyType in selector.agencyType" >{{agencyType.name}}</md-option>
        </md-select>
      </div>
      <div ng-show="tradeStat.businessLine && tradeStat.businessLine.businessLineName === '银行总对总'">
        <md-select multiple ng-model="tradeStat.agencyCode">
          <md-select-label>{{tradeStat.agencyCode ? _getNames(tradeStat.agencyCode,'agencyName',selector.agencys) : "全部"}}</md-select-label>
          <md-option ng-value="" ng-click="_checkAll(tradeStat,'agencyCode')">全部</md-option>
          <md-option ng-value="agency" ng-repeat="agency in selector.agencys" >{{agency.agencyName}}</md-option>
        </md-select>
      </div>
      <div ng-if="!tradeStat.businessLine || tradeStat.businessLine.businessLineName !== '银行总对总'"></div>
      <div ng-if="!tradeStat.businessLine || tradeStat.businessLine.businessLineName !== '银行总对总'"></div>
      <div></div>
      <div></div>
      <div>
        <label style="">时间粒度</label>
        <md-select ng-model="tradeStat.timeType">
          <md-select-label>{{tradeStat.timeType ? _getNames(tradeStat.timeType,'timeTypeName',selector.timeType) : "日"}}</md-select-label>
          <md-option ng-value="timeType" ng-repeat="timeType in selector.timeType" >{{timeType.timeTypeName}}</md-option>
        </md-select>
      </div>
      <input-quarter-group start-time="tradeStat.quarter.startTime" end-time="tradeStat.quarter.endTime" ng-switch-when="4"></input-quarter-group>
      <div ng-if="!tradeStat.timeType || tradeStat.timeType.timeTypeCode !== '4'">
      <md-input-container flex>
        <label >开始时间</label>
        <input name="dateStartTime" type="date" time-validate="day"  end-time="date.endTime" ng-model="date.startTime"  ng-switch-default required>
        <div ng-messages="tradeStatForm.dateStartTime.$error">
          <div ng-message="date">请正确输入时间</div>
          <div ng-message="time-error">开始时间不应大于结束时间</div>
        </div>
        <input name="monthStartTime" time-validate="month" ng-model="date.startTime"  end-time="date.endTime" type="month" ng-switch-when="3" required>
        <div ng-messages="tradeStatForm.monthStartTime.$error">
          <div ng-message="date">请正确输入时间</div>
          <div ng-message="time-error">开始时间不应大于结束时间</div>
        </div>
        <input ng-model="date.startTime"  time-validate="year" end-time="date.endTime" type="number" ng-switch-when="5" name="startQuarter" required>
        <div ng-messages="tradeStatForm.startQuarter.$error">
          <div ng-message="required">请正确输入时间</div>
          <div ng-message="time-error">开始时间不应大于结束时间</div>
        </div>
      </md-input-container>
      </div>
      <div ng-if="!tradeStat.timeType || tradeStat.timeType.timeTypeCode !== '4'">
        <md-input-container flex>
          <label>结束时间</label>
          <input name="dateEndTime" time-validate="day" type="date" ng-model="date.endTime"  start-time="date.startTime" ng-switch-default required>
          <div ng-messages="tradeStatForm.dateEndTime.$error">
            <div ng-message="date">请正确输入时间</div>
            <div ng-message="time-error">结束时间不应小于开始时间</div>
            <div ng-message="too-great">结束时间不应大于当前时间</div>
          </div>
          <input name="monthEndTime" time-validate="month" ng-model="date.endTime"  type="month" start-time="date.startTime" ng-switch-when="3" required>
          <div ng-messages="tradeStatForm.monthEndTime.$error">
            <div ng-message="date">请正确输入时间</div>
            <div ng-message="time-error">结束时间不应小于开始时间</div>
            <div ng-message="too-great">结束时间不应大于当前时间</div>
          </div>
          <input ng-model="date.endTime"  time-validate="year" start-time="date.startTime" type="number" ng-switch-when="5" name="endQuarter" required>
            <div ng-messages="tradeStatForm.endQuarter.$error">
            <div ng-message="required">请正确输入时间</div>
            <div ng-message="time-error">结束时间不应小于开始时间</div>
            <div ng-message="too-great">结束时间不应大于当前时间</div>
          </div>
        </md-input-container >
      </div>
      </div>
      <i class="glyphicon glyphicon-chevron-up shrinkage" ng-show="flag.isQuery" ng-click="flag.formIsFold = true"></i>
      <md-button ng-click="tradeStatQuery()" class="md-fab md-primary md-hue-1" aria-label="Profile">
      <i class="glyphicon glyphicon-search"  ng-show="!flag.formIsFold"></i>
      <i class="glyphicon glyphicon-arrow-down" style="margin-top:28px;" ng-show="flag.formIsFold"></i>
      </md-button>
    </div>
  </form>
  <div class="table-info">
    <div style="margin-bottom:20px;margin-left:40px">
      <div class="menus"></div>
      <md-button  ng-click="resetParam()"  class="md-raised" ng-show="flag.isQuery">重置</md-button>
      <form action="{{exportUrl}}"  target="_black"  method="post" style="display: initial;" ng-show="flag.isQuery">
        <input type='hidden' name="data"  value='{{viewObj.exportParam}}'>
        <md-button  type="submit"  class="md-raised">导出Excel</md-button>
      </form>
    </div>
    <div class="table-detail" ng-show="flag.isQuery">
      <div class="t_r">
        <table class="table table-bordered">
          <thead>
            <tr>
              <th>渠道</th>
              <th>成功笔数</th>
              <th>失败笔数</th>
              <th>完成情况比率</th>
              <th>重发次数</th>
              <th>冲正次数</th>
              <th>交易平均时长</th>
              <th>成功缴费金额</th>
              <th>失败缴费金额</th>
            </tr>
          </thead>
          <tbody>
            <tr ng-repeat="item in viewObj.series">
              <td>{{item.channelName}}</td>
              <td>{{item.succeedCount}}</td>
              <td>{{item.failTotal}}</td>
              <td>{{item.succeedRate}}</td>
              <td>{{item.resendCount}}</td>
              <td>{{item.reverseCount}}</td>
              <td>{{item.averageTime}}</td>
              <td>{{item.successMoney}}</td>
              <td>{{item.failMoney}}</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</div>